package com.itheima.demo02;

/**
 * @author Zhang_Han
 * @version 1.0
 * @date 2020/7/13 15:07
 */
public class Desk {
    //判断有没有包子;初始化值为没有false;
    //public static boolean flag = false;
    private boolean flag;

    //锁,因为锁必须是唯一的锁,所以不能更改,使用final修饰;
    //public static final Object lock = new Object();
    private final Object lock = new Object();
    //包子的总数,根据包子的总数来判断厨师和吃货总共分别是多少个包子;
    //public static int count = 10;
    private int count;

    public Desk() {
        this(false,10);
    }

    public Desk(boolean flag, int count) {
        this.flag = flag;
        this.count = count;
    }

    public boolean isFlag() {
        return flag;
    }

    public void setFlag(boolean flag) {
        this.flag = flag;
    }

    public Object getLock() {
        return lock;
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }

    @Override
    public String toString() {
        return "Desk{" +
                "flag=" + flag +
                ", lock=" + lock +
                ", count=" + count +
                '}';
    }
}
